<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:p="http://primefaces.org/ui"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition template="/pages/home.xhtml">
	<ui:define name="title">
		<h:outputText value="#{text.titSocio}" />
	</ui:define>
	<ui:define name="js">
		<h:outputScript name="jquery.meioMask.1.1.3.js" library="js"></h:outputScript>
	</ui:define>
	<ui:define name="content">
		<p:fieldset id="fieldSetPesquisaSocio" legend="#{text.lgdPesquisaForm}"
			toggleable="true" binding="#{socioController.fieldSetPesquisaSocio}">
			<h:inputHidden id="socioId"	value="#{socioController.selectedSocio.idSocio}" />
			<h:panelGrid id="pnlFields" columns="4" cellpadding="4">
				<h:panelGroup>
					<h:outputLabel for="filterSocioNome" value="#{text.lblSocioNome}"/>
					<p:spacer width="10px;" />
					<p:inputText id="filterSocioNome" size="40" value="#{searchHelper.filtersMap['socio']['nomeSocio'].value}" />
				</h:panelGroup>
				<h:panelGroup>
					<h:outputLabel for="filterMatriculaSiape" value="#{text.lblSocioMatriculaSiape}" />
					<p:spacer width="10px;" />
					<p:inputText id="filterMatriculaSiape" size="15" value="#{searchHelper.filtersMap['socio']['matSiape'].value}" />
				</h:panelGroup>
				<h:panelGroup>
					<h:outputLabel for="filterMatriculaSocial" value="#{text.lblSocioMatriculaSocial}" />
					<p:spacer width="10px;" />
					<p:inputText id="filterMatriculaSocial" size="15" value="#{searchHelper.filtersMap['socio']['matSocial'].value}" />
				</h:panelGroup>
				<h:panelGroup>
					<h:outputLabel for="filterReparticao" value="#{text.lblReparticao}" />
					<p:spacer width="10px;" />
					<p:inputText id="filterReparticao" size="30" value="#{searchHelper.filtersMap['socio']['reparticao.descReparticao'].value}" />
				</h:panelGroup>
			</h:panelGrid>


			<p:separator />

		<p:outputPanel style="padding:10px;">
			<p:commandButton id="btnNew" value="#{text.btnNew}" action="#{socioController.newSocio}"
				icon="ui-icon-document"  immediate="true" async="true" ajax="false"
				onclick="grdSocio.unselectAllRows();clearRadioDataTable();"/>
			<p:commandButton id="btnSearch" value="#{text.btnSearch}" icon="ui-icon-search" update=":frmContent:grdSocio"/>
			<p:commandButton id="btnReset" value="#{text.btnReset}" icon="ui-icon-refresh" 
				actionListener="#{searchHelper.reset}" update=":frmContent:grdSocio, frmContent:fieldSetPesquisaSocio"/>
		</p:outputPanel>
		
		</p:fieldset>
		
		<p:spacer height="10px"/>

		<p:dataTable id="grdSocio" var="socio"
			value="#{socioController.socioDataModel}" widgetVar="grdSocio"
			emptyMessage="#{text.grdEmpty}"
			selection="#{socioController.selectedSocio}" paginator="true"
			selectionMode="single" rowIndexVar="index"
			rows="10" rowsPerPageTemplate="10,25,50"
			paginatorTemplate=" {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
			style="width:100%;" sortBy="#{socio.nomeSocio}">

			<p:ajax event="rowSelect" update=":frmContent:fieldSetPesquisaSocio"
				listener="#{socioController.selectSocio}" global="false"/>

			<p:column id="colSocioEdit" headerText="#{text.btnEdit}" styleClass="cell-button">
				<p:commandButton id="btnEdit" 
				onclick="grdSocio.selectRow(#{index},'');loaderDialog.show();"
				oncomplete="redirect('/pages/socio/form.xhtml?selectedMenu=1');"
			    icon="ui-icon-pencil" immediate="true" global="false"/> 
			</p:column>
			<p:column id="colSocioNome" headerText="#{text.lblSocioNome}"
				sortBy="#{socio.nomeSocio}">
				<h:outputText value="#{socio.nomeSocio}" />
			</p:column>
			<p:column id="colSocioMatSiape" headerText="#{text.lblSocioMatriculaSiape}"
				sortBy="#{socio.matSiape}">
				<h:outputText value="#{socio.matSiape}" />
			</p:column>
			<p:column id="colSocioMatSocial" headerText="#{text.lblSocioMatriculaSocial}"
				sortBy="#{socio.matSocial}">
				<h:outputText value="#{socio.matSocial}" />
			</p:column>
			<p:column id="colSocioReparticao" headerText="#{text.lblReparticao}"
				sortBy="#{socio.reparticao.descReparticao}">
				<h:outputText value="#{socio.reparticao.descReparticao}" />
			</p:column>
		</p:dataTable>
		
		


	</ui:define>
</ui:composition>

</html>